package com.example.demo.configuration;

import org.apache.catalina.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.security.PublicKey;
@Configuration
public class BeanUserInfo {
    /**
     * 这里两个name 都是 Bean 传参
     * @return
     */

//    @Bean
//    public String name2() {
//        return "lisi";
//    }
    @Bean
    public UserInfo userInfo() {
        UserInfo userInfo = new UserInfo();
        userInfo.setId(1);
        userInfo.setName("zhangsan");
        userInfo.setAge(18);
        return userInfo;
    }
    @Bean
    public String name() {
        return "lisi";
    }
    @Bean
    public UserInfo userInfo2(String name) {
        UserInfo userInfo = new UserInfo();
        userInfo.setId(2);
        userInfo.setName(name);
        userInfo.setAge(19);
        return userInfo;
    }
}
